import './index.less';
import {useEffect,useState} from 'react'
import { Table, Tag, Space } from 'antd';
import {useDispatch,useSelector,ClassListModelState,useHistory} from 'umi';
const Classlist:React.FC = () => {
    const history=useHistory();
    const columns = [
        {
          title: '班级名',
          dataIndex: 'grade_name',
          key: 'grade_name',
        },
        {
          title: '课程名称',
          dataIndex: 'subject_text',
          key: 'subject_text',
        },
        {
          title: '阅卷状态',
          dataIndex: 'address',
          key: 'address',
        },
        {
          title: '课程名称',
          key: 'subject_text',
          dataIndex: 'subject_text',
        },
        {
          title: '成材率',
          key: 'room_text',
          dataIndex: 'room_text',
        },
        {
          title: '操作',
          key: 'action',
          render:(key:any)=>{    
            return <div
            onClick={() => {
              console.log(key);
              history.push(`/main/classmate/${key.grade_id}`)
            }}
           style={{color:'#0139FD'}}>
            批卷
          </div>
            
          }
        }
    ];
    const dispatch=useDispatch();
    useEffect(() => {
        dispatch({
          type:'exam/getmangergrade',  
      });
      }, [])
      let {mangerlist}=useSelector((model:{exam:ClassListModelState})=>model.exam)
      let data= mangerlist.map((item:any,index:number)=>{return {...item,key:index}})
      return (
        <div className="classlist">
            <h2>待批班级</h2>
            <div className='classlist_conntent'>
                <Table columns={columns} dataSource={data} pagination={false} />
            </div>
        </div>
    )
}
export default Classlist